<html lang="en" xmlns:th="http://www.thymeleaf.org">


<head id="head">

</head>

<body id="body">

</body>

<script th:inline="javascript">
    var REG_BODY = /<body[^>]*>([\s\S]*)<\/body>/;
    var REG_HEAD = /<head[^>]*>([\s\S]*)<\/head>/;

    function getBody(content) {
        var result = REG_BODY.exec(content);
        if (result && result.length === 2)
            return result[1];
        return content;
    }

    function regx(content, reg) {
        var result = reg.exec(content);
        if (result && result.length === 2)
            return result[1];
        return content;
    }

    window.onload = function () {

        console.log("load report");
        var report = [[${report.getReportText()}]];
        let head = document.getElementById("head");
        head.innerHTML = regx(report, REG_HEAD);

        let body = document.getElementById("body");
        body.innerHTML = regx(report, REG_BODY);
    }
</script>
</html>